Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
"Could not find a declaration file for module" when importing existing .jsx files

(Apologies if this is a duplicate, I can't find any Q&A's that deal with existing .jsx files)

I've been migrating my app over to typescript and have now got a load of the following errors:

Could not find a declaration file for module '../components/...'. '.../components/....js' implicitly has an 'any' type.ts(7016)

I'd prefer not to have to go through my entire app right now and convert everything to .tsx. I feel like turning noImplicitAny to false in my tsconfig file would be excessive, given that I only want to ignore the issue of imports right now.

Is there a more sensible way to resolve these errors?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should create the types for some packages which doesn't exist.

declare module 'objectname' {
  const content: any;
  export default content;
}

All the javascript modules may not consist of types for it. So, we need to create type definitions for the object which we define. The easiest way to define for the third party is as above. Because of the webpack checks for the respective index.d.ts. The d.ts is the type definition file for the object you will have.

In your case, it is missing and hence you receive that error. So a type definition file has to be created with the object name. Or it will be sometimes the extensions.

any refers to any datatype within the object. You must get your hands dirty with typescript interfaces and types.

Simple example

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda